<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html>
<html lang="en" class="no-js">

<head>
<meta http-equiv="content-type" content="text/html" charset="utf-8" />
<title>订单新增</title>
<link rel="stylesheet"
	href="${pageContext.request.contextPath }/admin/qf/bootstrap-3.3.7-dist/css/bootstrap.min.css" />
<link rel="stylesheet"
	href="${pageContext.request.contextPath }/admin/qf/css/add.css" />
</head>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/admin/qf/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/admin/qf/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
</head>
<script type="text/javascript">
	$(function() {
		fun();
		fan();
		addupdate();
	});

	function fun() {
		$.ajax({
			dataType : "json",
			type : "post",
			url : "${pageContext.request.contextPath }/findCar",
			dataType : 'json',
			success : function(msg) {
				var len = msg.length;
				for (var i = 0; i <= len; i++) {
					$("#select1").append(
							"<option value='"+msg[i].cid+"'>" + msg[i].cname
									+ "</option>");
				}
			}
		});
	}
	function fan() {
		$.ajax({
			dataType : "json",
			type : "post",
			url : "${pageContext.request.contextPath }/findBservice",
			dataType : 'json',
			success : function(msg) {
				var len = msg.length;
				for (var i = 0; i <= len; i++) {
					$("#select2").append(
							"<option value='"+msg[i].bserviceId+"'>"
									+ msg[i].bserviceName + "</option>");
				}
			}
		});
	}
	//判断form表单是添加还是修改
	var addupdate = function() {
		if ($("#rid").val() == null || $("#rid").val() == "") {
			$("#div1").css('display', 'none');
			$("form").attr('action',
					'${pageContext.request.contextPath }/addRepair')
		} else {
			$("#div1").css('display', 'block');
			$("form").attr(
					'action',
					'${pageContext.request.contextPath }/updateRepair?repairId='
							+ $("#rid").val())
		}
	}
</script>
<body>
	<hr>
	<b>&nbsp;&nbsp;新增订单</b>
	<hr>
	<form action="${pageContext.request.contextPath }/addRepair"
		method="post">
		<div class="add">
			<div id="div1">
				职位编号：<input type="text" id="rid" value="${model.repairId}"
					name="recruitId" disabled="disabled" class="tt" />
			</div>
			<table style="border-collapse: separate; border-spacing: 0px 20px;">
				<tr align="right">
					<td>客户姓名：</td>
					<td align="left"><input value="${model.repairName}"
						type="text" name="repairName" class="tt" /></td>
				</tr>
				<tr align="right">
					<td>电话号码：</td>
					<td align="left"><input type="text"
						value="${model.repairPhone}" name="repairPhone" class="tt" /></td>
				</tr>
				<tr align="right">
					<td>汽车类型：</td>
					<td align="left"><select id="select1" name="car.cid"><option
								value="">--请选择车型--</option></select></td>
				</tr>
				<tr align="right">
					<td>汽车牌号：</td>
					<td align="left"><input type="text"
						value="${model.repairBrand}" name="repairBrand" class="tt" /></td>
				</tr>
				<tr align="right">
					<td>服务时间：</td>
					<td align="left"><input name="repairBtime"
						value="${model.repairBtime}" class="tt" type="date" /><span
						class='info' id="appointmentTime"></span></td>
				</tr>
				<tr align="right">
					<td>服务时长：</td>
					<td align="left"><input type="text"
						value="${model.repairTime}" name="repairTime" class="tt" /></td>
				</tr>
				<tr align="right">
					<td>服务类型：</td>
					<td align="left"><select id="select2"
						name="bservice.bserviceId"><option value="">--请选择服务--</option></select></td>
				</tr>
				<tr align="right">
					<td>服务人员：</td>
					<td align="left"><input type="text"
						value="${model.repairPerson}" name="repairPerson" class="tt" /></td>
				</tr>
				<tr align="right">
					<td>服务费用：</td>
					<td align="left"><input type="text"
						value="${model.repairMoney}" name="repairMoney" class="tt" /></td>
				</tr>
				<tr align="right">
					<td>提车时间：</td>
					<td align="left"><input name="repairEtime"
						value="${model.repairEtime}" class="tt" type="date" /><span
						class='info' id="appointmentTime"></td>
				</tr>
				<tr>
					<td></td>
					<td align="left"><input type="submit" class="btn btn-primary"
						style="width: 100px; height: 40px;" value=" 提  交 " /><br></td>
				</tr>
			</table>
		</div>
	</form>
</body>

</html>